﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using SEMS.Models;
using SEMS.DAL;

namespace SEMS.BLL
{
    public class StudentBS
    {
        /// <summary>
        /// 获取所有学生列表
        /// </summary>
        /// <returns>学生列表</returns>
        static public List<Student> GetStudentList()
        {
            using (var db = new SEMSDBContext())
            {
                return db.Student.ToList();
            }
        }

        /// <summary>
        /// 获取全班学生
        /// </summary>
        /// <param name="class_id">大班号</param>
        /// <returns>全班学生列表</returns>
        static public List<Student> GetStudentList(string class_id)
        {
            using (var db = new SEMSDBContext())
            {
                return db.Student.Where(x => x.class_id == class_id).ToList();
            }
        }

        /// <summary>
        /// 获取全班学生
        /// </summary>
        /// <param name="class_id">大班号</param>
        /// <param name="class_small_id">小班号</param>
        /// <returns>全班学生列表</returns>
        static public List<Student> GetStudentList(string class_id, string class_small_id)
        {
            using (var db = new SEMSDBContext())
            {
                return db.Student.Where(x => x.class_id == class_id && x.class_small_id == class_small_id).ToList();
            }
        }
    }
}